<html>
<head >
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script>
    <title>通过ajax调用WebService服务</title>
    <script>
        function sendMsg(){
            $.ajax({
                type: "POST",   //访问WebService使用Post方式请求
                contentType: "application/json", //WebService 会返回Json类型
                url: "http://localhost:8080/test/user?wsdl/getUser", //调用WebService的地址和方法名称组合 ---- WsURL/方法名
                data: "{userId:1}",         //这里是要传递的参数，格式为 data: "{paraName:paraValue}",下面将会看到
                dataType: 'json',
                success: function(result) {     //回调函数，result，返回值
                   alert(result)
                }
            });
        }

    </script>
</head>
<body>
<input type="button" value="发送SOAP请求" onclick="sendMsg();">
<input type="text" id="name">
<div id="showInfo">
</div>
</body>
</html>